<div class="page" data-ng-controller="editContentCtrl">

    <section class="panel panel-default table-dynamic" style="padding-bottom: 60px">
        <div class="panel-heading">
            <strong>
                <span class="glyphicon glyphicon-th"></span>编辑内容</strong>
        </div>
        <div class="panel-body">
            <div class="col-md-11 col-md-1">
                <form class="form-horizontal form-validation" role="form">

                    <div class="form-group">
                        <label for="title" class="col-sm-2 control-label">标题</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="title" placeholder="请填写标题"
                                   value="{{content.name}}" data-ng-model="content.name"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">首页展示图(300*200)</label>
                        <label class="col-sm-offset-1 col-sm-6" style="background-color: #f5f5f5">
                            <img class="img-responsive text-center" width="300px" height="200px"
                                 ng-src="{{content.coverUrl || 'images/pic.png'}}">
                            <input type="file" title="选择封面" style="opacity:0;z-index: 10;position: absolute"
                                   bc-image-upload="{ preview : 'backgroundLogoUrl', model : 'content.coverUrl',
                    callbackFunc: 'imgUploadCallback' }"/>
                        </label>
                    </div>

                    <div class="form-group ">
                        <label for="type" class="col-sm-2 control-label pull-left">内容类型</label>
                        <div class="col-sm-6">
                            <select id="type" class="form-control" ng-model="content.type">
                                <option value="article"> 文章|新闻</option>
                                <option value="video"> 视频</option>
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="summary" class="col-sm-2 control-label">内容简介</label>
                        <div class="col-sm-10">
                            <textarea class="form-control" id="summary" required placeholder="" rows="3"
                                      value="{{content.summary}}" data-ng-model="content.summary"/>
                        </div>
                    </div>

                    <div class="form-group" ng-show="content.type == 'video'">
                        <label for="title" class="col-sm-2 control-label">上传视频</label>
                        <div class="col-sm-10">
                            <input type="file" class="form-control"
                                   bc-image-upload="{ model : 'content.videoUrl', progressPercent: 'progressPercent',
                                callbackFunc: 'imgUploadCallback' }" accept="video/*"/>
                        </div>
                        <div class="col-sm-offset-2 col-sm-10" ng-if="progressPercent > 0" style="margin-top:15px;">
                            <div class="progress-bar progress-bar-info progress-bar-striped active" style="width: 0!important;">
                                <div class="progress-value">{{progressPercent}}%</div>
                            </div>
                        </div>
                    </div>

                    <div class="form-group" ng-show="content.type == 'video'">
                        <label  class="col-sm-2 control-label"><span class="color-danger">*</span>视频地址</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control"
                                   value="content.videoUrl" data-ng-model="content.videoUrl" placeholder="可以选择上传本地视频或者直接引用网络视频"/>
                        </div>
                    </div>

                    <div class="form-group" ng-show="content.type == 'article'">
                        <label class="col-sm-2 control-label">内容</label>
                        <div class="col-sm-10">
                            <div id="editor-trigger" style="height: 620px">
                            </div>
                        </div>
                    </div>

                    <div class="form-group ">
                        <label for="menu" class="col-sm-2 control-label pull-left">所属菜单</label>
                        <div class="col-sm-4">
                                <select class="form-control" id="menu" data-ng-model="content.menuId"
                                        data-ng-options="_menu.menuId as _menu.menuName for _menu in menus" ng-change="changeMenu()"></select>
                        </div>
                        <div class="col-sm-4">
                            <select class="form-control" id="submenu" data-ng-model="content.subMenuId"
                                    data-ng-options="_submenu.menuId as _submenu.menuName for _submenu in filterSubMenus" ></select>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="time" class="col-sm-2 control-label">发布时间</label>
                        <div class="col-sm-6">
                            <div class="dropdown">
                                <a class="dropdown-toggle" id="time" role="button" data-toggle="dropdown" data-target="javascript:0" href="javascript:0">
                                    <div class="input-group"><div class="form-control" >{{content.updateAt | date:'yyyy-MM-dd HH:mm' }}</div><span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span>
                                    </div>
                                </a>
                                <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
                                    <datetimepicker data-ng-model="content.updateAt" data-datetimepicker-config="{ dropdownSelector: '#time',startView:'year', minView:'minute'  }"/>
                                </ul>
                            </div>
                        </div>

                    </div>

                    <div class="form-group ">
                        <label for="type" class="col-sm-2 control-label pull-left">在网站首页显示</label>
                        <div class="col-sm-6">
                            <select  class="form-control"
                                    ng-model="content.stick">
                                <option value="N"> 不显示到网站首页</option>
                                <option value="Y"> 在网站首页显示</option>
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-10">
                            <button type="submit" class="btn btn-success btn-w-md pull-right"
                                    data-ng-click="saveContent()">保存
                            </button>
                        </div>
                    </div>
                </form>
            </div>

        </div>
    </section>


</div>